<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="/html/axios.min.js"></script>
<script src="/html/util.js"></script>
<script>
    //得到前一页面提交的表单数据
    var id = getQuery("id")
    window.onload = function (){
        showInfo();
    }

    function showInfo(){
        axios.get("/car/findById",{
            params:{
                id
            }
        }).then(e => {
            var info = e.data;
            $('type').innerHTML =
            $('color').innerHTML = info.color;
        })
    }

    function update(){
        axios.get("/car/update",{
            params: {
                id,
                price: $('price').value
            }
        }).then(e => {
            var info = e.data;
            if (info == "ok"){
                location.href = "/html/car/index.html";
            }
        })
    }
</script>
<body>
    <h2>修改汽车信息</h2>
    品牌:<span id="type"></span><br>
    价格:<input type="text" id="price"><br>
    颜色:<span id="color"></span><br>
    <input type="button" value="修改" onclick="update()">
</body>
</html>